package com.example.ibsp_demo.pojo.entity.content;

import java.time.LocalDateTime;
import java.util.List;

public class Content {
    private Integer ctid;
    private Integer auid; // 作者 uid
    private Integer pid; // 分区 id
    private String title;
    private String summary; // 摘要
    private String content; // 内容
    private String cover; // 封面url
    private LocalDateTime publishTime;
    private Integer status; // 帖子状态 -1:未通过 0:在审核 1:正常 2:封禁

    // 新增字段：阅读量、点赞数、评论数
    private Integer viewCount; // 阅读量
    private Integer likeCount; // 点赞数
    private Integer commentCount; // 评论数

    public Integer getFavoriteCount() {
        return favoriteCount;
    }

    public void setFavoriteCount(Integer favoriteCount) {
        this.favoriteCount = favoriteCount;
    }

    private Integer favoriteCount;

    public List<ContentTag> getTags() {
        return tags;
    }

    public void setTags(List<ContentTag> tags) {
        this.tags = tags;
    }

    private List<ContentTag> tags;

    // 关联的热度排名信息
    private ContentHotRank contentHotRank;

    // 无参构造函数
    public Content() {
    }

    // 全参构造函数（包含新增字段）
    public Content(Integer ctid, Integer auid, Integer pid, String title, String summary, String content, String cover,
                   LocalDateTime publishTime, Integer status, Integer viewCount, Integer likeCount, Integer commentCount) {
        this.ctid = ctid;
        this.auid = auid;
        this.pid = pid;
        this.title = title;
        this.summary = summary;
        this.content = content;
        this.cover = cover;
        this.publishTime = publishTime;
        this.status = status;
        this.viewCount = viewCount;
        this.likeCount = likeCount;
        this.commentCount = commentCount;

    }

    // Getter 和 Setter 方法（新增字段的 getter/setter）
    public Integer getViewCount() {
        return viewCount;
    }

    public void setViewCount(Integer viewCount) {
        this.viewCount = viewCount;
    }

    public Integer getLikeCount() {
        return likeCount;
    }

    public void setLikeCount(Integer likeCount) {
        this.likeCount = likeCount;
    }

    public Integer getCommentCount() {
        return commentCount;
    }

    public void setCommentCount(Integer commentCount) {
        this.commentCount = commentCount;
    }

    // 关联热度排名的 getter/setter（已存在，保留）
    public ContentHotRank getContentHotRank() {
        return contentHotRank;
    }

    public void setContentHotRank(ContentHotRank contentHotRank) {
        this.contentHotRank = contentHotRank;
    }

    // 其他原有字段的 getter/setter（保留）
    public Integer getCtid() {
        return ctid;
    }

    public void setCtid(Integer ctid) {
        this.ctid = ctid;
    }

    public Integer getAuid() {
        return auid;
    }

    public void setAuid(Integer auid) {
        this.auid = auid;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCover() {
        return cover;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    public LocalDateTime getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(LocalDateTime publishTime) {
        this.publishTime = publishTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    // 重写 toString 方法（包含新增字段）
    @Override
    public String toString() {
        return "Content{" +
                "ctid=" + ctid +
                ", auid=" + auid +
                ", pid=" + pid +
                ", title='" + title + '\'' +
                ", summary='" + summary + '\'' +
                ", content='" + (content != null ? content.substring(0, Math.min(content.length(), 50)) + "..." : "null") + '\'' +
                ", cover='" + cover + '\'' +
                ", publishTime=" + publishTime +
                ", status=" + status +
                ", viewCount=" + viewCount +
                ", likeCount=" + likeCount +
                ", commentCount=" + commentCount +
                ", contentHotRank=" + contentHotRank +
                '}';
    }
}